<?php
// +----------------------------------------------------------------------
// | PHP [ JUST YOU ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2017 http://www.jyphp.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: FlyingPig <flyingpigfp@163.com>
// +----------------------------------------------------------------------

namespace App\Http\Controllers;


use App\Exceptions\ApiException;
use App\Logic\SmsLogic;
use Illuminate\Support\Facades\DB;

class Sms extends Base
{

    /**
     * 发送注册短信
     * @return string
     * @throws ApiException
     */
    public function register()
    {
        if (DB::table('t_player_info')->where('phone_num',$this->param['phone'])->value('id')) {
            throw new ApiException('手机号码已注册');
        }
        return $this->returnData(
            SmsLogic::instance()->registerSms($this->param['phone'])
        );
    }

}